home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / em-xmkit.zip / EMM28_B.ASM < prev    next >
Assembly Source File  |  1989-11-29  |  8KB  |  134 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM28_B.ASM                                             ;
  3. ;                                                                             ;
  4. ; OS FUNCTION NAME:   set_alt_reg_set                                         ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   The function does one of two things, depending on the   ;
  7. ;                     map register set specified:                             ;
  8. ;                                                                             ;
  9. ;                     1. If the alternate map register set specified is zero, ;
  10. ;                        map register set zero is activated.  If the map      ;
  11. ;                        register context restore area far pointer is not     ;
  12. ;                        null, the contents of the restore area pointed to by ;
  13. ;                        the far pointer &alt_context are copied into         ;
  14. ;                        register set zero on the expanded memory hardware in ;
  15. ;                        the system.  If the pointer is null, the contents    ;
  16. ;                        are not copied.                                      ;
  17. ;                                                                             ;
  18. ;                        Regardless of its value, the map register context    ;
  19. ;                        restore area pointer is saved within the memory      ;
  20. ;                        manager.  It will be used during the get_alt_reg_set ;
  21. ;                        function.                                            ;
  22. ;                                                                             ;
  23. ;                        The operating system must supply the far pointer to  ;
  24. ;                        the area.  This function is intended to simulate     ;
  25. ;                        setting an alternate map register set.  Note that    ;
  26. ;                        the operating system must allocate the space for     ;
  27. ;                        the context.  The memory manager saves the context   ;
  28. ;                        save area far pointer internally.                    ;
  29. ;                                                                             ;
  30. ;                     2. If the alternate map register set specified is not   ;
  31. ;                        zero, the alternate map register set specified is    ;
  32. ;                        activated.  The restore area, which the operating    ;
  33. ;                        system is pointing to, is not used.                  ;
  34. ;                                                                             ;
  35. ;           PASSED:   alt_reg_set:                                            ;
  36. ;                        is the number of the alternate map register set      ;
  37. ;                        which is to be activated.                            ;
  38. ;                                                                             ;
  39. ;                     &alt_context:                                           ;
  40. ;                        is a far pointer to an OS/E supplied map register    ;
  41. ;                        context restore area.  This far pointer must always  ;
  42. ;                        be passed if the expanded memory hardware does not   ;
  43. ;                        supply alternate mapping register sets.              ;
  44. ;                                                                             ;
  45. ;                        The memory manager must save this pointer whenever   ;
  46. ;                        the OS/E invokes this function.  The OS/E must have  ;
  47. ;                        allocated the space for the restore area.            ;
  48. ;                        Additionally, the contents of this restore area must ;
  49. ;                        have been initialized by the memory manager before   ;
  50. ;                        it will contain any useful information.  The OS/E    ;
  51. ;                        initializes the restore area it has allocated by     ;
  52. ;                        invoking the get_context function.  After the OS/E   ;
  53. ;                        has done this, the restore area will contain the     ;
  54. ;                        state of the mapping hardware in the system, and any ;
  55. ;                        additional information necessary to restore the      ;
  56. ;                        hardware to its original state when the operating    ;
  57. ;                        system invokes a set_alt_reg_set function.           ;
  58. ;                                                                             ;
  59. ;         RETURNED:   status:                                                 ;
  60. ;                        is the status EMM returns from the call.  All other  ;
  61. ;                        returned results are valid only if the status        ;
  62. ;                        returned is zero.  Otherwise they are undefined.     ;
  63. ;                                                                             ;
  64. ;                     alt_context:                                            ;
  65. ;                        If alt_reg_set is not equal to zero:                 ;
  66. ;                           The alternate map register set is activated.  A   ;
  67. ;                           far pointer to a map register context restore     ;
  68. ;                           area is not required.                             ;
  69. ;                                                                             ;
  70. ;                        If alt_reg_set is equal to zero:                     ;
  71. ;                           The far pointer &alt_context points to an area    ;
  72. ;                           which contains the state of all the mapping       ;
  73. ;                           hardware in the system, and any additional        ;
  74. ;                           information necessary to restore the hardware to  ;
  75. ;                           its original state.                               ;
  76. ;                                                                             ;
  77. ; C USE CONVENTION:   unsigned int          status;                           ;
  78. ;                     unsigned int          alt_reg_set;                      ;
  79. ;                     static CONTEXT_STRUCT alt_context;                      ;
  80. ;                                                                             ;
  81. ;                     status = set_alt_reg_set (alt_reg_set,                  ;
  82. ;                                               &alt_context);                ;
  83. ;-----------------------------------------------------------------------------;
  84. .XLIST
  85. PAGE    60,132
  86.  
  87. IFDEF SMALL
  88.    .MODEL SMALL, C
  89. ENDIF
  90. IFDEF MEDIUM
  91.    .MODEL MEDIUM, C
  92. ENDIF
  93. IFDEF LARGE
  94.    .MODEL LARGE, C
  95. ENDIF
  96. IFDEF COMPACT
  97.    .MODEL COMPACT, C
  98. ENDIF
  99. IFDEF HUGE
  100.    .MODEL HUGE, C
  101. ENDIF
  102.  
  103. INCLUDE emmlib.equ
  104. INCLUDE emmlib.str
  105. INCLUDE emmlib.mac
  106. .LIST
  107. .CODE
  108.  
  109. set_alt_reg_set        PROC                                                  \
  110.             USES DI,                                              \
  111.             alt_reg_set:WORD,                                     \
  112.             far_ptr_alt_context:FAR PTR DWORD
  113.  
  114.     ;---------------------------------------------------------------------;
  115.     ;   do;                                                               ;
  116.     ;   .   set the current active alternate map register set or the      ;
  117.     ;   .   current mapping context if alternate map register sets are    ;
  118.     ;   .   not supported;                                                ;
  119.     ;---------------------------------------------------------------------;
  120.     MOVE        AX, set_alt_map_reg_set_fcn 
  121.     MOVE        BX, alt_reg_set
  122.     MOVE        ES:DI, far_ptr_alt_context
  123.     INT         EMM_int
  124.  
  125.     ;---------------------------------------------------------------------;
  126.     ;   .   return (EMM status);                                          ;
  127.     ;   end;                                                              ;
  128.     ;---------------------------------------------------------------------;
  129.     RET_EMM_STAT    AH
  130.  
  131. set_alt_reg_set        ENDP
  132.  
  133. END
  134.